////////////////////////////////////////////////////////////////////////////////
//      
//      Kingsoft File for shp routines file
//      
//      File      : shp_bmp.h
//      Comment   : simple html parser bmp obj class
//					
//      Create at : 2008-09-11
//      Create by : chenguicheng
//      
////////////////////////////////////////////////////////////////////////////////

#pragma once

#include "shpsupport.h"

#define SHP_IMG_ITEM_KEY					TEXT("img")

class shp_img_item : public shp_dom_item
{
public:

	shp_img_item()
	:m_i_sub(0)
	{
		
	};

	~shp_img_item()
	{
		
	};

	//set_attribute( p, m )
	BEGIN_KEY_MAP()
		//to add new attribute map( key map to member )
		ADD_STR_KEY		( L"skin",			m_str_skin )
		ADD_INT_KEY		( L"sub",			m_i_sub )
		BASE_CLASS_PROCESS( shp_dom_item )
	END_KEY_MAP()

	void init_rect( CRect& parent_rect )
	{
		__super::calc_rect( parent_rect );
	}

	void draw_item( shpdc& dc, CRect& draw_rect )
	{
		shp_skin_mgr::Instance().draw( dc, m_i_sub, m_str_skin, get_item_rect(), draw_rect, true );
	}

	bool hit_test( UINT umsg, int x, int y, DWORD& dw_id )
	{
		return false;
	}

	void draw_img( shpdc& dc, CRect& draw_rect )
	{
		shp_skin_mgr::Instance().draw( dc, m_i_sub, m_str_skin, get_item_rect(), draw_rect, false );
	}


protected:

	int			m_i_sub;
	shpstr		m_str_skin;
	

};

